Title: SQL W3S (By-BKK) / 004 Distinct
Tags: Obsidian_to_Anki

Q: What does SELECT DISTINCT do in SQL?
A: Returns only distinct (different) values from a column

Q: True/False: SELECT DISTINCT removes duplicate values
A: True

Q: How do you select all unique countries from the Customers table?
A: SELECT DISTINCT Country FROM Customers

Q: What happens if you omit DISTINCT in a SELECT query?
A: All values, including duplicates, are returned

Q: What is the syntax for SELECT DISTINCT with multiple columns?
A: SELECT DISTINCT column1, column2 FROM table_name

Q: Which table is used in W3Schools examples for SELECT DISTINCT?
A: Customers

Q: True/False: COUNT(DISTINCT column_name) works in all SQL databases
A: False

Q: How do you count distinct countries in Customers table?
A: SELECT COUNT(DISTINCT Country) FROM Customers

Q: What is the workaround for counting distinct values in MS Access?
A: SELECT Count(*) AS DistinctCountries FROM (SELECT DISTINCT Country FROM Customers)

Q: SELECT DISTINCT Country FROM Customers
A: How do you select all unique countries from the Customers table?

Q: True
A: Does SELECT DISTINCT remove duplicate values?

Q: Customers
A: Which table is used in W3Schools examples for SELECT DISTINCT?